package com.mingshine.cloud.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;

@Configuration //配置类
public class Swagger2Config {
    /**
     * com.mingshine.cloud.controller包的路径，不然生成的文档扫描不到接口
     *
     * @return
     */
    @Bean
    Docket docket() {
        return new Docket(DocumentationType.SWAGGER_2)
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.mingshine.cloud.controller"))
                .paths(PathSelectors.any())
                .build()
                .apiInfo(new ApiInfoBuilder()
                        .description("描述：测试接口..测试接口测试接口测试接口测试接口测试接口测试接口测试接口测试接口测试接口.")
                        .title("标题：明耀_测试系统_接口文档")
                        .version("V1.0.0")
                        .contact(new Contact("明耀", "335415534@qq.com", "335415534@qq.com"))
                        .build());
    }
}
